package com.itheima.health.jobs;

import com.alibaba.dubbo.config.annotation.Reference;
import com.itheima.health.service.OrderService;
import lombok.extern.slf4j.Slf4j;

import java.text.SimpleDateFormat;
import java.util.Date;

@Slf4j
public class ClearHistoryOrderJob {

    @Reference
    private OrderService orderService;

    public void clearHistoryOrderJob() {
        log.info("[清理历史订单]开始……");
        Date date = new Date();
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        orderService.deleteByDate("2019-4-1");
        log.info("[清理历史订单]完成{}",sdf.format(date));
    }
}
